﻿//----------------------------------------------------

#region 命名空间

//    版权：
//    作者：
//建立时间：2012-09-11 00:00:33
//    描述：
//----------------------------------------------------
using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using WinnerCMS.Data;
using WinnerCMS.Model;
using WinnerCMS.Common;

#endregion

namespace WinnerCMS.BLL
{
    /// <summary>
    /// 业务逻辑类 WinnerCMS_GoodsCustomFields 的摘要说明。
    /// </summary>
    public class GoodsCustomFieldsManage
    {
        private static readonly GoodsCustomFieldsDal MyDAL = new GoodsCustomFieldsDal();

        #region 添加

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        public Result Add(GoodsCustomField model)
        {
            Result resu = new Result();
            if (model.FieldName.Length == 0)
            {
                resu.Errors = "“字段名”不能为空！";
                return resu;
            }

            MyDAL.Add(model);
            return resu;
        }

        #endregion

        #region 删除

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="selectFields"></param>
        /// <param name="categoryId"></param>
        public void Delete(IList<string> selectFields, int categoryId)
        {
            MyDAL.Delete(selectFields, categoryId);
        }

        #endregion

        /// <summary>
        /// 取得该栏目使用的自定义字段
        /// </summary>
        /// <param name="categoryId"></param>
        /// <returns></returns>
        public IList<GoodsCustomField> GetFieldsList(int categoryId)
        {
            return MyDAL.GetFieldsList(categoryId);
        }
    }
}